import socket

socket_client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
socket_client.connect(("127.0.0.1", 8888))
print("客户端已启动，已完成链接")

while True:
    print("请输入要传给服务器的数据：")
    data = input()
    socket_client.send(data.encode("utf-8"))
    if data == "close":
        print("客户端关闭")
        socket_client.close()
        break
    recv = socket_client.recv(1024).decode("utf-8")
    print("接收到的服务器回复的数据：", recv)


